<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出用户数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/sys/user/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			var flag = ${user.delFlag}
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/sys/user/listHY");
			if(flag == '1')
				$("#searchForm").attr("action","${ctx}/sys/user/listHSZ");
			$("#searchForm").submit();
	    	return false;
	    }
		
		//选为审核通过
		 function shtg(type) {
			var i = 0;
			var cId = "'-1'";
			$("input:checkbox").each(function() {
				if($(this).attr("checked")=='checked'){
					i++;
					cId+=",'"+$(this).val()+"'";
				}
			}); 
			if(i>0){
				$("#btnForm").attr("action","${ctx}/admin/sysRecommended/delete?type="+type+"dataId="+cId+"&&url=/admin/houseSellSp");
				$("#btnForm").submit();
				//dialog("选为已下订单",'url:dd_update.jsp?c=1'+cid,'280px','130px','window');
				//setTimeout(shuaxin,2000);
				return true;
			} else {
				$("#note").html("<font color=red>请至少选择一条记录</font>");
				return false;
			}
		};
		
		//清除缓存
		function clearCache(userId){
			//服务预约列表信息
			url = "${ctx}/sys/user/clearCache/id/"+userId;
			$.ajax({
				 type: "get",
				 url: url,
				 dataType : 'json',
				// data: parameter,
				 success: function(data, textStatus){
					alert("同步成功");
				 },
				 complete: function(XMLHttpRequest, textStatus){
				 },
				 error: function(){
				 }
			});
		};
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/sys/user/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/sys/user/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/user/listHY">模特列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="user" action="${ctx}/sys/user/listHY" method="post" class="breadcrumb form-search ">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<ul class="ul-form">
			<li><label>登录名：</label><form:input path="loginName" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li><label>姓&nbsp;&nbsp;&nbsp;名：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<form:form id="btnForm" action="#" method="post" class="breadcrumb form-search"><input type="checkbox" id="checkedAll" name="all" />全选
		&nbsp;
		<c:if test="${tj != null and tj == '1'  }">
	    		<input type="button" value="取消首页推荐模特" name="sytj" id="sytj"  onclick="shtg('1')"/>
	    </c:if>
	    &nbsp;
	    <c:if test="${tj != null and tj == '2'  }">
	    	 <input type="button" value="取消模特圈推荐模特" name="mtqtj" id="mtqtj" onclick="shtg('2')">
	     </c:if>
	<span id=note>
	</span>
	</form:form>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><th class="sort-column account">登录名</th>
					   <th class="sort-column name">模特名称</th>
					   <th>电话</th>
					   <th>国籍</th>
					   <th>城市</th>
					   <th>模特经验</th>
					   <shiro:hasPermission name="sys:user:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="user">
			<tr>
				<td><a href="${ctx}/sys/user/formHY?id=${user.id}">${user.loginName}</a></td>
				<td>${user.name}</td>
				<td>${user.phone}</td>
				<td>${user.gjName}</td>
				<td>${user.areaName}</td>
				<td>${user.exp}年</td>
				<shiro:hasPermission name="sys:user:edit"><td>
    				
    				<c:if test="${user.delFlag=='1'}">
						<a href="${ctx}/sys/user/formHYDetail?id=${user.id}">明细</a>
    					<a href="${ctx}/sys/user/updateUser?id=${user.id}" onclick="return confirmx('确认要还原该用户吗？', this.href)">还原</a>
    				</c:if>
					<c:if test="${user.delFlag=='0'}">
						<a href="${ctx}/sys/user/formHY?id=${user.id}">修改</a>
    					<a href="${ctx}/sys/user/delete?id=${user.id}" onclick="return confirmx('确认要删除该用户吗？', this.href)">删除</a>
    				</c:if>
				
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>